package com.asimplefox.controllers;

/**
 * @author github.kloping
 */

import com.asimplefox.entity.AasrTask;
import com.asimplefox.service.IAasrTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author github.kloping
 */
@RestController
@RequestMapping("/api/aasr")
public class AasrTaskController {
    @Autowired
    IAasrTaskService iAasrTaskService;

    @GetMapping("list")
    public Object list(@RequestParam(value = "status", required = false) String status) {
        if (status == null) return iAasrTaskService.list();
        else {
            return iAasrTaskService.lambdaQuery().eq(AasrTask::getStatus, status).list();
        }
    }
}
